-- supply_item
-- create by cheny3
-- 拾取补给用品

return {
    -- 判断
    canTrigger = function(args)
        -- 判断有没有补给用品
        local supplyItems = AutoFightM.getData()["supplyItems"];
        if supplyItems and #supplyItems > 0 then
            return true;
        end
        return false;
    end,

    -- 触发
    trigger = function(args)
        local supplyItems = AutoFightM.getData()["supplyItems"];
        if not supplyItems or #supplyItems <= 0 then
            return false;
        end

        -- 拾取一个
        DungeonActionM.go("pick_item", supplyItems[1]);

        -- 抛出事件
        EventMgr.fire(event.PLAYER_MOVE, supplyItems[1]);
        return true;
    end,
};
